namespace Cos.Core.NHibernate
{
    using System;

    using Cos.Core.Model.Security;

    using Iesi.Collections.Generic;

    public class AccountDataModel : DataModelBase<User>
    {
        #region Constructors and Destructors

        public AccountDataModel() { }

        #endregion

        #region Properties

        public virtual int Id { get; set; }

        public virtual string AccountName { get; set; }

        public virtual bool IsSystem { get; set; }

        //public virtual IEnumerable<AccountDataModel> AssociatedAccounts { get; set; }

        #endregion

        #region Object Overrides

        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return false;
            }

            var model = obj as AccountDataModel;

            return model != null && this.Id == model.Id;
        }

        public override int GetHashCode()
        {
            return this.Id.GetHashCode();
        }

        #endregion

        #region Overrides of DataModelBase<User>

        public override void Fill(User model)
        {
            throw new NotImplementedException();
        }

        public override User ToModel()
        {
            var model = this.CreateModel();

            model.AccountId = this.Id;
            model.UserName = this.AccountName;

            return model;
        }

        #endregion
    }
}